<?php
require_once("../includes/connect.php");
$menu_name = $_POST["menu_name"];
$menu_link = $_POST["menu_link"];
$menu_status = $_POST["menu_status"];

$source_template = "../template/page_template.php";
$destination = "../../".$menu_link;
copy($source_template, $destination);
chmod($destination, 0777);
//Create menu file
// fopen($menu_link, "w") or die("Could not open this file");
// chmod($menu_link, 0777);
// file_put_contents($menu_link, "this is a new file");
//echo "string";
$sql = "INSERT INTO tb_menu (menu_name,menu_link,menu_status) VALUES ('".$menu_name."','".$menu_link."',".$menu_status.")";
	
mysql_query($sql);
echo 0;
?>